﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace Problem16
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger num = new BigInteger(2);
            BigInteger power = BigInteger.Pow(num, 1000);

            long sum = 0;

            foreach (char c in power.ToString())
            {
                sum += int.Parse(c + "");
            }

            Console.WriteLine(sum);
            Console.ReadKey();
        }
    }
}
